package com.imau.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.nio.charset.StandardCharsets;


@WebServlet("/getPar")
public class GetParServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1.获取参数

        String username = request.getParameter("username");
        //2.解码
        byte[] bytes = username.getBytes(StandardCharsets.ISO_8859_1);

        System.out.println(new String(bytes, StandardCharsets.UTF_8));

    }
}
